%p
  %form{:onsubmit=>"return confirm('Are you sure you want to delete?');", :method=>"GET", :action=>"/delete/#{@entity.entity_id}"}
    %a.btn.btn-success{:href=>"/download/#{@entity.entity_id}"} Download
    -if auth
      %button.btn.btn-warning{:type=>"submit"} Delete
    -if auth
      %a#cpencil.btn.btn-info{:href=>"#"} Edit
  -if auth
    %label.checkbox
      %input#private{:type=>"checkbox",:value=>"true",:name=>"value",:onclick=>"$.post('/change', { name: 'private', value: $('#private').is(':checked'), pk: '#{@entity.entity_id}' } );",:checked=>@entity.private} Private
  %h2#name{"data-type"=>"text", "data-pk"=>"#{@entity.entity_id}"}= @entity.name
  #content{"data-type"=>"wysihtml5", "data-pk"=>"#{@entity.entity_id}", :url=>"/change","data-toggle"=>"manual","data-original-title"=>"Edit Entity"}= @entity.content
-if auth
  :javascript
    $(function(){
      $('#content').editable({
        url: '/change',
        title: 'Edit Content',
        wysihtml5: {
        stylesheets: false, "color": true, "html": true,
        parserRules: {
          classes: {
            "middle": 1,
            "alignleft": 1,
            "alignright": 1,
            "heading": 1
          },
          tags: {
            link: {
              "check_attributes": {
                  "rel": "alt",
                  "href": "href"
                  }
            },
            table: {
              "check_attributes": {
                  "cellpadding": "numbers",
                  "cellspacing": "numbers",
                  "width": "numbers",
                  "border": "numbers",
                  "frame": "alt",
                  "rules": "alt"
              }},
            "td": {
              "check_attributes": {
                  "rowspan": "numbers",
                  "colspan": "numbers"
              },
              "add_class": {
                  "align": "align_text"
              }},
            tr: {},
            th: {},
            hr: {},
            p: {},
            h5: {"rename_tag": "div"},
            tbody:{}
          }}}
      });
      $('#name').editable({
        url: '/change',
        title: 'Enter name' 
      });
      $('#cpencil').click(function(e) {
        e.stopPropagation();
        e.preventDefault();
        $('#content').editable('toggle');
      });
    });
-if auth
  %div= haml :notes